


<!DOCTYPE html>
<html id="htmlId">
<head>
  <title>Coverage Report > BoardFactoryTest</title>
  <style type="text/css">
    @import "../../css/coverage.css";
    @import "../../css/idea.min.css";
  </style>
  <script type="text/javascript" src="../../js/highlight.min.js"></script>
  <script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
</head>

<body>
<div class="content">
<div class="breadCrumbs">
Current scope:     <a href="../../index.html">all classes</a>
    <span class="separator">|</span>
    <a href="../index.html">nl.tudelft.jpacman.board</a>
</div>

<h1>Coverage Summary for Class: BoardFactoryTest (nl.tudelft.jpacman.board)</h1>

<table class="coverageStats">
<tr>
  <th class="name">Class</th>
<th class="coverageStat 
">
  Class, %
</th>
<th class="coverageStat 
">
  Method, %
</th>
<th class="coverageStat 
">
  Line, %
</th>
</tr>
<tr>
  <td class="name">BoardFactoryTest</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/1)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/7)
  </span>
</td>
<td class="coverageStat">
  <span class="percent">
    0%
  </span>
  <span class="absValue">
    (0/19)
  </span>
</td>
</tr>

</table>

<br/>
<br/>


<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package nl.tudelft.jpacman.board;
&nbsp;
&nbsp;import static org.assertj.core.api.Assertions.assertThat;
&nbsp;import static org.mockito.Mockito.mock;
&nbsp;import nl.tudelft.jpacman.sprite.PacManSprites;
&nbsp;
&nbsp;import org.junit.jupiter.api.BeforeEach;
&nbsp;import org.junit.jupiter.api.Test;
&nbsp;
&nbsp;import java.util.Arrays;
&nbsp;
&nbsp;/**
&nbsp; * Tests the linking of squares done by the board factory.
&nbsp; *
&nbsp; * @author Jeroen Roosen 
&nbsp; */
<b class="nc">&nbsp;class BoardFactoryTest {</b>
&nbsp;
&nbsp;    /**
&nbsp;     * The factory under test.
&nbsp;     */
&nbsp;    private BoardFactory factory;
&nbsp;
&nbsp;    /**
&nbsp;     * Square on the board to test.
&nbsp;     */
&nbsp;    private Square s1;
&nbsp;
&nbsp;    /**
&nbsp;     * Square on the board to test.
&nbsp;     */
&nbsp;    private Square s2;
&nbsp;
&nbsp;    /**
&nbsp;     * Resets the factory under test.
&nbsp;     */
&nbsp;    @BeforeEach
&nbsp;    void setUp() {
<b class="nc">&nbsp;        PacManSprites sprites = mock(PacManSprites.class);</b>
<b class="nc">&nbsp;        factory = new BoardFactory(sprites);</b>
&nbsp;
<b class="nc">&nbsp;        s1 = new BasicSquare();</b>
<b class="nc">&nbsp;        s2 = new BasicSquare();</b>
&nbsp;    }
&nbsp;
&nbsp;    /**
&nbsp;     * Verifies that a single cell is connected to itself on all sides.
&nbsp;     */
&nbsp;    @Test
&nbsp;    void worldIsRound() {
<b class="nc">&nbsp;        factory.createBoard(new Square[][]{{s1}});</b>
<b class="nc">&nbsp;        assertThat(Arrays.stream(Direction.values()).map(s1::getSquareAt)).containsOnly(s1);</b>
&nbsp;    }
&nbsp;
&nbsp;    /**
&nbsp;     * Verifies a chain of cells is connected to the east.
&nbsp;     */
&nbsp;    @Test
&nbsp;    void connectedEast() {
<b class="nc">&nbsp;        factory.createBoard(new Square[][]{{s1}, {s2}});</b>
<b class="nc">&nbsp;        assertThat(s1.getSquareAt(Direction.EAST)).isEqualTo(s2);</b>
<b class="nc">&nbsp;        assertThat(s2.getSquareAt(Direction.EAST)).isEqualTo(s1);</b>
&nbsp;    }
&nbsp;
&nbsp;    /**
&nbsp;     * Verifies a chain of cells is connected to the west.
&nbsp;     */
&nbsp;    @Test
&nbsp;    void connectedWest() {
<b class="nc">&nbsp;        factory.createBoard(new Square[][]{{s1}, {s2}});</b>
<b class="nc">&nbsp;        assertThat(s1.getSquareAt(Direction.WEST)).isEqualTo(s2);</b>
<b class="nc">&nbsp;        assertThat(s2.getSquareAt(Direction.WEST)).isEqualTo(s1);</b>
&nbsp;    }
&nbsp;
&nbsp;    /**
&nbsp;     * Verifies a chain of cells is connected to the north.
&nbsp;     */
&nbsp;    @Test
&nbsp;    void connectedNorth() {
<b class="nc">&nbsp;        factory.createBoard(new Square[][]{{s1, s2}});</b>
<b class="nc">&nbsp;        assertThat(s1.getSquareAt(Direction.NORTH)).isEqualTo(s2);</b>
<b class="nc">&nbsp;        assertThat(s2.getSquareAt(Direction.NORTH)).isEqualTo(s1);</b>
&nbsp;    }
&nbsp;
&nbsp;    /**
&nbsp;     * Verifies a chain of cells is connected to the south.
&nbsp;     */
&nbsp;    @Test
&nbsp;    void connectedSouth() {
<b class="nc">&nbsp;        factory.createBoard(new Square[][]{{s1, s2}});</b>
<b class="nc">&nbsp;        assertThat(s1.getSquareAt(Direction.SOUTH)).isEqualTo(s2);</b>
<b class="nc">&nbsp;        assertThat(s2.getSquareAt(Direction.SOUTH)).isEqualTo(s1);</b>
&nbsp;    }
&nbsp;}
</code>
</pre>
</div>

<script type="text/javascript">
(function() {
    var msie = false, msie9 = false;
    /*@cc_on
      msie = true;
      @if (@_jscript_version >= 9)
        msie9 = true;
      @end
    @*/

    if (!msie || msie && msie9) {
      hljs.highlightAll()
      hljs.initLineNumbersOnLoad();
    }
})();
</script>

<div class="footer">
    
    <div style="float:right;">generated on 2023-04-11 19:46</div>
</div>
</body>
</html>
